home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-serious-
/
programming
/
c
/
stormamiga_lib-v45_00d
/
include
/
string.h
< prev
next >
Wrap
C/C++ Source or Header
|
2000-02-28
|
3KB
|
152 lines
#ifndef _INCLUDE_STRING_H
#define _INCLUDE_STRING_H
/*
** $VER: string.h 1.2 (7.2.97)
** StormC Release 3.0
**
** '(C) Copyright 1995/96/97 Haage & Partner Computer GmbH'
** All Rights Reserved
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef NULL
#define NULL 0
#endif
typedef unsigned int size_t;
#ifndef _INLINE_INCLUDES
char *strcpy (char *, const char *);
char *strcat (char *, const char *);
int strcmp (const char *, const char *);
size_t strlen(const char *);
#endif
char *strncpy(char *, const char *, size_t);
char *strncat(char *, const char *, size_t);
int strncmp(const char *, const char *, size_t);
char *strchr (const char *, int);
char *strrchr(const char *, int);
size_t strspn (const char *, const char *);
size_t strcspn(const char *, const char *);
char *strpbrk(const char *, const char *);
char *strstr(const char *, const char *);
char *strerror(int);
char *strtok(char *, const char *);
int stricmp(const char *, const char *);
int strnicmp(const char *, const char *, size_t);
char *strlwr(char *);
char *strupr(char *);
#ifndef _INLINE_INCLUDES
void *memcpy(void *, const void *, size_t);
void *memmove(void *, const void *, size_t);
void *memset(void *, int, size_t);
#endif
int memcmp(const void *, const void *, size_t);
void *memchr(const void *, int, size_t);
#ifndef STORMAMIGA
#define bzero(a,b) memset(a,0,b)
#endif
#ifdef __cplusplus
}
#endif
#ifdef _INLINE_INCLUDES
__inline char *strcpy (char *d, const char *s)
{
char *e = d;
while ((*(e++) = *(s++)))
;
return d;
}
__inline char *strcat (char *d, const char *s)
{
char *e = d;
while (*(e++))
;
e--;
while ((*(e++) = *(s++)))
;
return d;
}
__inline int strcmp(const char *s1, const char *s2)
{
int retval = 0;
char ch1,ch2;
while ((ch1 = *(s1++)) && ch1 == *(s2++))
;
return ch1 ? ((ch2 = *(s2-1)) == ch1 ? 0 : (ch1 < ch2 ? -1 : 1)) : (*s2 ? -1 : 0);
}
__inline size_t strlen(const char *s)
{
const char *t = s;
while (*(t++))
;
return (size_t) (t - s - 1);
}
#ifndef STORMAMIGA_INLINE
__inline void *memcpy(void *d, const void *s, size_t n)
{
void *r = d;
n++;
while (--n > 0)
{
*(((unsigned char *) d)++) = *(((unsigned char *) s)++);
};
return r;
}
__inline void *memmove(void *d, const void *s, size_t n)
{
void *r = d;
if ((unsigned char *) d > (unsigned char *) s)
{
n++;
while (--n > 0)
{
*(((unsigned char *) d)++) = *(((unsigned char *) s)++);
};
}
else
{
(unsigned char *) d += n;
(unsigned char *) s += n;
n++;
while (--n > 0)
*(--((unsigned char *) d)) = *(--((unsigned char *) s));
};
return r;
}
__inline void *memset(void *m, int c, size_t n)
{
void *r = m;
n++;
while (--n > 0)
*(((unsigned char *) m)++) = (unsigned char) c;
return r;
}
#endif /* STORMAMIGA_INLINE */
#endif
/*----- support for stormamiga.lib -----*/
#ifdef STORMAMIGA
#ifndef STRING_STORMAMIGA_H
#include <string_stormamiga.h>
#endif
#endif
#endif